%ifndef BOOT_MEMORY_SEGMENTDESCRIPTOR
%define BOOT_MEMORY_SEGMENTDESCRIPTOR
; Segment Descriptor
;; 段描述符大小为4字节
%define SEGMENT_DESCRIPTOR_SIZE  (4)
;; 平坦模型，地址从0开始
%define SEGMENT_DESCRITOR_BASE  (0)
;; 段大小限制，平坦模型，32位全1，4 GiB
%define SEGMENT_DESCRIPTOR_LIMIT  ((0b1111 << 48) | 0xffff) 
;; Type字段，共四位，以下字段分别对应这四位，根据需要设定
; accessed
%define SEGMENT_DESCRIPTOR_TYPE_ACCESSED  (0b1 << 40)
; writable for data and readable for code (writable indicates readable)
%define SEGMENT_DESCRIPTOR_TYPE_WRITE_READ  (0b1 << 41) 
; expand-down for data or conforming for code
%define SEGMENT_DESCRIPTOR_TYPE_EXPAND_CONFORM  (0b1 << 42) 
; code (#11 = 1) or data (#11 = 0)
%define SEGMENT_DESCRIPTOR_TYPE_CODE  (0b1 << 43) 
;; code/data（S=1）或 SYSTEM（S=0）段 segment for code/data (S set) or system (S clear)
%define SEGMENT_DESCRIPTOR_S_CODEDATA  (0b1 << 44) 
;; 描述符特权级（只使用两种特权级，对应目态和管态）user mode, kernel mode by default
%define SEGMENT_DESCRIPTOR_DPL_USER  (0b11 << 45) 
;; 段是否在内存中 present (P set), not present (P clear)
%define SEGMENT_DESCRIPTOR_PRESENT  (0b1 << 47) 
; available bit for OS
%define SEGMENT_DEXCRIPTION_AVAILABLE  (0b1 << 52) 
; 64-bit code (L set), else (L clear)
%define SEGMENT_DESCRIPTOR_LONG  (0b1 << 53) 
; D/B Flag
%define SEGMENT_DESCRIPTOR_DEFAULT32_BIG  (0b1 << 54) 
; G Flag (4 KiB Granularity if set)
%define SEGMENT_DESCRIPTOR_4KiB_GRANULARITY  (0b1 << 55) 
%endif